﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Data;
using System.Text;
using SYH.Utils;
using syh876.com.Areas.User.Code;
using SYH.Enum;

namespace syh876.com.Areas.User.Controllers
{
    public class ProductController : Controller
    {
        #region

        #endregion

        #region //------产品信息----------
        //产品列表信息
        /// <summary>
        /// 会员后台产品信息列表
        /// </summary>
        /// <param name="Status">状态 -1关闭(删除) 0待审 1通过 - 2拒绝 </param>
        /// <returns></returns>
        public ActionResult ProductList(int Status = 0)
        {
            //string strSql = string.Format(" and Status={0} and UserId={1}", Status, IdentityHelper.ClientUser.UserId);  //需要获取userId
            //PagerSource ps = new PagerSource("p", 15);
            //int pageCount = 0;
            //int recordCount = 0;
            //DataTable Product_Dt = SYH.Product.BLL.Product_Info.GetPageData(ps.PageSize, ps.CustomPage, strSql.ToString(), out pageCount, out recordCount);

            //return View(Product_Dt);
            return View();
        }
        //编辑产品信息
        public ActionResult ProductDetail(int id = 0)
        {
            //#region 产品行业
            //string sqlWhere = " Status=0";
            //DataTable Product_IndustryDt = SYH.Product.BLL.Industry_Info.GetList(sqlWhere).Tables[0];
            //ViewBag.Product_IndustryDt = Product_IndustryDt;
            //#endregion
            //Product_Info model = SYH.Product.BLL.Product_Info.GetModel(id);
            ////获取产品详情
            //ViewBag.Introduction = SYH.Product.BLL.Product_Info.GetProductIntroduction(id);
            //if (model == null)
            //{
            //    model = new SYH.Product.Model.Product_Info();
            //}

            //return View(model);
            return View();
        }
        //保存
        [HttpPost]
        [ValidateInput(false)]
        public ActionResult ProductSave()//Product_Info model
        {
            //model = Common.ModelHelper.FillModel<Product_Info>(model);
            //if (model.Id > 0)
            //{
            //    if (SYH.Product.BLL.Product_Info.Update(model))
            //    {
            //        return Content("1");
            //    }
            //    else
            //    {
            //        return Content("0");
            //    }

            //}
            //else
            //{
            //    if (SYH.Product.BLL.Product_Info.Add(model) > 0)
            //    {
            //        return Content("1");
            //    }
            //    else
            //    {
            //        return Content("0");
            //    }
            //}
            return Content("0");
        }

        [HttpPost]
        public ActionResult ProductDelete(int id)
        {
            //if (SYH.Product.BLL.Product_Info.Delete(idList))
            //{
            //    return Content("1");
            //}
            //else
            //{
            //    return Content("0");
            //}
            //#region 删除图片  （--物理删除 真删）
            //Product_Info model = SYH.Product.BLL.Product_Info.GetModel(id);
            //foreach (var item in (model.Images.Split('~')))
            //            {
            //                if (!string.IsNullOrEmpty(item))
            //                {
                         
            //                }
            //            }
            //#endregion
            //string field = "Status";
            //string value = ((int)ProStatus.删除).ToString();
            //string strWhere = " Id=" + id;
            //if (SYH.Product.BLL.Product_Info.UpdateOneField(field, value, strWhere, false))
            //{
            //    return Content("1");
            //}
            //else
            //{
            //    return Content("0");
            //}
            return Content("0");
        }
        #endregion


    }
}
